package CtrlLayer;
import java.util.ArrayList;
import ModelLayer.Employee;
import ModelLayer.EmployeeContainer;


/**
 * Write a description of class EmployeeController here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class EmployeeController
{
    private EmployeeContainer employeeContainer;
    
    public EmployeeController()
    {
        employeeContainer = EmployeeContainer.getInstance();
    }

    public void createEmployeeObjects()
    {
        employeeContainer.addEmployee(new Employee("Kaval", "Sofiendelsvej 59", "Aalborg", "9001", "kaval1@gmail.com", 2));
    }
    
    public void createEmployee(String name, String address, String city, String postCode, String eMail, int employeeId)
    {
        employeeContainer.addEmployee(new Employee(name, address, city, postCode, eMail, employeeId));
    }
    
    public Employee findEmployee(int employeeId)
    {
        return employeeContainer.findEmployeeById(employeeId);
    }
    
    public void deleteEmployee(int employeeId)
    {
        employeeContainer.deleteEmployee(employeeContainer.findEmployeeById(employeeId));
    }
    
    public void updateEmployee(String name, String address, String city, String postCode, String eMail, int employeeId)
    {
        Employee c = employeeContainer.findEmployeeById(employeeId);
        if(c !=null)
        {
            c.setName(name);
            c.setAddress(address);
            c.setCity(city);
            c.setPostCode(postCode);
            c.setEMail(eMail);
        }
    }
}
